﻿using System;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using EPiServer.Framework;
using EPiServer.Research.MobileCenter;
using EPiServer.Shell;
using EPiServer.Shell.Dashboard;
using EPiServer.Shell.Gadgets;
using System.Collections.Generic;


namespace EPiServer.Research.MobileCenter.Example
{

    /// <summary>
    /// Initializes the site and adds a route for the changed pages
    /// </summary>
    [ModuleDependency(typeof(EPiServer.Web.InitializationModule))]
    public class MobileCenterGadgetsInitializer : IInitializableModule
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
           routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
           routes.MapRoute("GetGuide", "pageguide/{name}", new { controller = "PageGuide", action = "GetPageGuide", name = (string)null });
        
           routes.MapRoute("GetRecently", "recently/{pageid}", new { controller = "MobileCenterChangedPages", action = "GetPage", pageid = (string)null });
 }

       
        #region IInitializableModule Members

        public void Initialize(EPiServer.Framework.Initialization.InitializationEngine context)
        {
            RegisterRoutes(RouteTable.Routes);  
        }

   
        public void Preload(string[] parameters)
        {
           
        }

        public void Uninitialize(EPiServer.Framework.Initialization.InitializationEngine context)
        {
            
        }

        #endregion
  }
}